PDO: Migrate maxlen of pdo_column_data from size_t to zend_long - #19144
PDO: Migrate maxlen of pdo_column_data from size_t to zend_long#19144marc-mabe wants to merge 2 commits into
Conversation
| struct pdo_column_data { | ||
| zend_string *name; | ||
| size_t maxlen; | ||
| zend_long maxlen; |
There was a problem hiding this comment.
Wouldn't this be more accurate?
| zend_long maxlen; | |
| ssize_t maxlen; |
There was a problem hiding this comment.
This is used only in getColumnMeta exposing to PHP as zend_long anyway.
|
Hmm... It seems that in pdo_odbc, a ulong value is passed here (according to the ODBC specification, an unsigned 64-bit integer might be passed). php-src/ext/pdo_odbc/odbc_stmt.c Line 614 in eaf24ba I suppose such columns are quite rare in practice, but this does introduce a slight possibility of a BC break. One alternative might be to add a flag instead of changing the type to signed. What do you think? @NattyNarwhal |
|
Already the situation in |
|
I see |
|
@SakiTakamachi @NattyNarwhal How should I proceed here? Any suggestions? |
|
I'd say this looks fine, though you may want to check Gina's suggestion. The issue in PDO_ODBC existed before this; it'd be good to fix that so it presumably uses the signed |
|
@NattyNarwhal I have updated the PR to set I hope this is fine for this PR as I'm not an ODBC user and my goal is reduce the changes needed in #19079 by splitting out what makes sense. |
NattyNarwhal
left a comment
There was a problem hiding this comment.
I think this makes sense (at least w/ ODBC).
|
@Girgias @SakiTakamachi Can this be merged? |
|
Have you had a chance to review Gina’s proposal? You may have overlooked it. |
Commented on it |
This is returned in PDOStatement::getColumnMeta as
lendocumented as "The length of this column. Normally -1 for types other than floating point decimals."Also, It was as
FIXMEalready.PQfsize: returns the space allocated for this column in a database row, in other words the size of the server's internal representation of the data type. (Accordingly, it is not really very useful to clients.) A negative value indicates the data type is variable-length.dbcollen: The maximum length, in bytes, of the data for the particular column. If the column number is not in range, dbcollen returns -1.XSQLVAR.sqllen->ISC_SHORT->signed short: length of data areaMYSQL_FIELD.lengthMYSQLND_FIELD.length->zend_ulong: Width of column (create length)unsigned long length: Width of column (create length)I noticed this during my work of 64bit integers on 32bit arch where it would was failing: https://github.com/php/php-src/actions/runs/16311803646/job/46068812948#step:9:2782